package com.liu.controller;

import com.liu.service.intf.FoodsService;
import com.liu.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/api/foods/")
@Api(value = "实现食品相关操作",tags = "实现食品相关操作")
public class FoodsController {
    @Autowired
    private FoodsService service;
//    直接列表查询
    @GetMapping("list.do")
    public R selectlist(){
        return service.querylist();
    }
//    按价格查
    @GetMapping("selectprice.do")
    public R selectByPrice(){
        return service.queryByPrice();
    }
//    按销量查询
    @GetMapping("querybybuy.do")
    public R queryByBuy(){
        return service.queryByBuy();
    }
    @GetMapping("detail.do")
    public R detail(int id){
        return service.selectDetail(id);
    }
}
